﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;

using DataObjects.ADO;

namespace WindowsFormsApplication1
{
    public partial class GiaHanThe : DevComponents.DotNetBar.Metro.MetroAppForm
    {
        public GiaHanThe(int maDG, string tenDG)
        {
            InitializeComponent();
            txtMaDG.Text = maDG.ToString();
            txtTenDG.Text = tenDG;
            dtimeNgayGiaHan.Value = DateTime.Today;
            TinhHanThe();
        }

        private void butCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }        

        private void TinhHanThe()
        {
            txtHanThe.Text = MainForm._ThamSo.ThoiHanTHe(dtimeNgayGiaHan.Text);
        }

        private void dtimeNgayGiaHan_Leave(object sender, EventArgs e)
        {
            TinhHanThe();
        }

        private void butOK_Click(object sender, EventArgs e)
        {
            MainForm._formThongTinDG.UpdateThoiHanThe(dtimeNgayGiaHan.Text);
        }        
    }
}
